<?php
class Pay_method_model extends BZ_Model
{
    protected $table = 'pay_method';
    
    public function findShortcut($shortcut)
    {
        $this->db->where('shortcut', $shortcut);
        $this->db->order_by('sort', 'asc');
        return $this->db->get($this->table);
    }
    
    public function findByBankId($pay_bank)
    {
        $this->db->where('bank_id', $pay_bank);
        $result = $this->db->get($this->table);
        return $result->row();
    }
    
    public function getAllBankId($isArray=false)
    {
        $this->db->order_by('sort', 'ASC');
        $result = $this->db->get($this->table);
        if ($isArray) {
            $rows = array();
            foreach ($result->result_array() as $row) {
                $rows[$row['bank_id']] = $row;
            }
            return $rows;
        }
        return $result;
    }

    public function findById($bankId)
    {
        $this->db->where('bank_id', $bankId);
        return$this->db->get($this->table);
    }
}